package test;

public class Demo4 {

    public static int x;
    public static int y;

    public static int a;
    public static int b;

    public static void method1() {
        x = 1;
        y = 2;
    }

    public static void method2() {
        a = y;
        b = x;
    }

    public static void main(String[] args) {
        Thread thread1 = new Thread(() -> {
            method1();
        });

        Thread thread2 = new Thread(() -> {
            method2();
        });

        thread1.start();
        thread2.start();

        System.out.println("a: " + a);
        System.out.println("b: " + b);
    }
}
